#include <glib-2.0/glib.h>
#include "tux_gsettings.h"
// more info at https://mail.gnome.org/archives/commits-list/2012-October/msg01711.html


void tux_gsettings_init() {
         tux_settings = g_settings_new("com.tuxin.TuxMusicStudio");
}


void tux_gsettings_audio_devices_in_new() {
    tux_gsettings_audio_in_variant_builder = g_variant_builder_new(G_VARIANT_TYPE("a(ss)"));
}

void tux_gsettings_audio_devices_in_add(const gchar *server_name, const gchar *device_name) {
    g_variant_builder_add(tux_gsettings_audio_in_variant_builder, "(ss)", server_name,device_name);    
}

static void tux_gsettings_audio_devices_in_save_variant() {
    tux_gsettings_audio_in_variant = g_variant_new("a(ss)", tux_gsettings_audio_in_variant_builder);
    g_variant_builder_unref(tux_gsettings_audio_in_variant_builder);    
}

void tux_gsettings_audio_devices_in_save() {
    tux_gsettings_audio_devices_in_save_variant();
    g_settings_set_value(tux_settings,"audio-devices-in",tux_gsettings_audio_in_variant);
}


GVariant *tux_gsettings_audio_devices_in_load() {
    GVariant *value=g_settings_get_value(tux_settings,"audio-devices-in");
    return value;
}
